﻿window.onerror = function (e) { return false }
/*@cc_on'left,right'.replace(/\w+/g, function (n) { document.createElement(n) })@*/

$B = window.Browser = {}; (function ()
{
    var s, ua = navigator.userAgent.toLowerCase();
    (s = ua.match(/msie ([\d.]+)/)) ? $B.msie = s[1] :
	(s = ua.match(/firefox\/([\d.]+)/)) ? $B.firefox = s[1] :
	(s = ua.match(/chrome\/([\d.]+)/)) ? $B.chrome = s[1] :
	(s = ua.match(/opera.([\d.]+)/)) ? $B.opera = s[1] :
	(s = ua.match(/version\/([\d.]+).*safari/)) ? $B.safari = s[1] : 0;
    if ($B.msie)
    {
        $B.ie6 = $B.msie == '6.0';
        $B.ie7 = $B.msie == '7.0';
        $B.ie8 = $B.msie == '8.0';
    }
})();
var Is = {
    STRING: new Function('object', "return typeof object == 'string'"),
    UNDEFINED: new Function('object', "return typeof object == 'undefined'"),
    NUMBER: new Function('object', "return typeof object == 'number'"),
    FUNCTION: new Function('object', "return typeof object == 'function'"),
    OBJECT: new Function('object', "return typeof object == 'object'"),
    BOOLEN: new Function('object', "return typeof object == 'boolean'"),
    ARRAY: new Function('object', "return object.constructor === Array"),
    NULL: new Function('object', "return object === null"),
    REGEXP: new Function('object', 'return object.constructor === RegExp')
};

Function.prototype.delay = function (timeout, zis)
{
    var me = this, args = Array.prototype.slice.call(arguments), timeout = args.shift(), zis = args.shift();
    return window.setTimeout(function () { me.apply(zis || window, args) }, timeout);
}

Array.prototype.setInterval = function (callback, timeout, receiver)
{
    (function (i, me, len)
    {
        callback.apply(receiver, [me[i], i]);
        if (i++ < len) setTimeout(arguments.callee, timeout);
    })(0, this, this.length - 1);
};
if (!Array.prototype.forEach)
    Array.prototype.forEach = function (callback, receiver)
    {
        for (var i = 0, length = this.length; i < length; i++)
            callback.call(receiver, this[i], i, this);
    };
if (!Array.prototype.indexOf)
    Array.prototype.indexOf = function (element, index)
    {
        var length = this.length;
        if (index == null) index = 0;
        else
        {
            index = parseInt(index, 10);
            if (index < 0) index += length;
            if (index < 0) index = 0;
        }
        for (var i = index; i < length; i++)
            if (this[i] === element) return i;
        return -1;
    };
if (!Array.prototype.filter)
    Array.prototype.filter = function (callback, receiver)
    {
        for (var i = 0, length = this.length, result = []; i < length; i++)
            if (callback.call(receiver, this[i], i, this)) result.push(this[i]);
        return result;
    };
Array.prototype.find = function (callback, receiver)
{
    for (var i = 0, length = this.length; i < length; i++)
        if (callback.call(receiver, this[i], i, this)) return i;
    return -1;
}
if (!Array.prototype.some)
    Array.prototype.some = function (callback, receiver)
    {
        for (var i = 0, length = this.length; i < length; i++)
            if (callback.call(receiver, this[i], i, this)) return true;
        return false;
    };
if (!Array.prototype.every)
    Array.prototype.every = function (callback, receiver)
    {
        for (var i = 0, length = this.length; i < length; i++)
            if (!callback.call(receiver, this[i], i, this)) return false;
        return true;
    };
Array.prototype.contains = function (item)
{
    return this.indexOf(item) > -1;
};
Array.prototype.pull = function (item)
{
    for (var i = 0, length = this.length, result = []; i < length; i++)
        if (this[i] !== item) result.push(this[i]);
    this.length = 0;
    result.forEach(function (item) { this.push(item) }, this);
    return this;
};
Array.prototype.setInterval = function (callback, timeout)
{
    var i = 0, me = this, _ = me.length - 1, args = $A(arguments, 2);
    (function ()
    {
        callback.apply(null, [me[i], i].concat(args));
        if (i++ < _) window.setTimeout(arguments.callee, timeout);
    })();
};
if (!Array.prototype.map)
    Array.prototype.map = function (callback, receiver)
    {
        for (var i = 0, length = this.length, result = []; i < length; i++)
            result.push(callback.call(receiver, this[i], i, this));
        return result;
    };
Array.prototype.invoke = function (method)
{
    var args = $A(arguments).slice(1);
    return this.map(function (value)
    {
        return value[method].apply(value, args);
    });
};
Array.prototype.swap = function (a, b)
{
    this[a] = [this[b], this[b] = this[a]][0];
    return this;
};
String.prototype.startWith = function (string) { return this.substr(0, string.length) === string };
String.prototype.endWith = function (string) { if (this.length < string.length) return false; return this.substr(this.length - string.length) === string }
String.prototype.trim = function ()
{
    return this.replace(/(^\s*)|(\s*$)/g, '');
};
String.prototype.format = function ()
{
    return String.format.apply(null, [this].concat(Array.prototype.slice.call(arguments)))
};
String.format = function (string)
{
    if (arguments.length <= 1) return string;
    if (typeof arguments[1] === 'object')
    {
        var args = arguments[1];
        return string.replace(/{(.+?)}/g, function (all, x) { return args[x] });
    }
    else
        for (var i = 1; i < arguments.length; i++)
            string = string.replace(new RegExp('\\{' + (i - 1) + '\\}', 'g'), arguments[i])
    return string;
};
String.prototype.set = function (key, value)
{
    var us = this.split('\?');
    if (us.length == 1) return this + '\?' + key + '=' + value;
    var dic = new Dictionary(us[1]);
    dic.add(key, value);
    return us[0] + '\?' + dic;
};
String.prototype.hash = function (separator)
{
    function add(pair)
    {
        if (!(pair = pair.split('='))[0]) return;
        var key = decodeURIComponent(pair.shift());
        tbl.add(key, pair.join('=') || key);
    }
    var match = this.trim().match(/([^?#]*)(#.*)?$/);
    if (!match) return {};

    var tbl = new Dictionary({}, true);
    match[1].split(separator || '&').forEach(add);
    return tbl.items;
};
String.prototype.lenb = function (str)
{
    return this.replace(/[^\x00-\xff]/g, '**').length;
}
String.prototype.repeat = function (n)
{
    for (var str = "", i = 0; i < n; i++)
        str += this.replace(new RegExp('{(.*?)}', 'g'), function (x) { return eval(x.substring(1, x.length - 1).replace(/\bi\b/g, i)) });
    return str;
}
String.prototype.toInt = function () { return parseInt(this, 10); }
Number.prototype.color = function ()
{
    var number = this.toFixed(), string = '';
    if (this < 0 || this > 0xffffff) return '';
    while (number > 0) { string = (number % 16).toString(16) + string; number = parseInt(number / 16); }
    return '#' + ('000000' + string).slice(-6);
};
Number.prototype.toFileSize = function ()
{
    if (this < 1024) return this + "B";
    else if (this < 1024 * 1024) return (this / 1024).toFixed(2) + "K";
    else if (this < 1024 * 1024 * 1024) return (this / 1024 / 1024).toFixed(2) + "M";
    else return "";
};
Number.array = function (min, max, increment)
{
    for (var arr = [], i = increment || 1, c = min - i; (c += i) <= max; ) arr.push(c);
    return arr;
}
Date.prototype.format = function (format)
{
    var o = {
        "M+": this.getMonth() + 1,
        "d+": this.getDate(),
        "h+": this.getHours(),
        "m+": this.getMinutes(),
        "s+": this.getSeconds(),
        "q+": Math.floor((this.getMonth() + 3) / 3),
        "S": this.getMilliseconds()
    }

    if (/(y+)/.test(format)) format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));

    for (var k in o)
        if (new RegExp("(" + k + ")").test(format))
            format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));

    return format;
}
Date.prototype.add = function (unit, value)
{
    switch (unit)
    {
        case 'y': this.setYear(this.getFullYear() + value); break;
        case 'M': this.setMonth(this.getMonth() + value); break;
        case 'd': this.setDate(this.getDate() + value); break;
        case 'h': this.setHours(this.getHours() + value); break;
        case 'm': this.setMinutes(this.getMinutes() + value); break;
        case 's': this.setSeconds(this.getSeconds() + value); break;
    }
    return this;
}
Date.prototype.diff = function (unit, compairDate)
{
    var o = { s: 1000, m: 1000 * 60, h: 1000 * 60 * 60, d: 1000 * 60 * 60 * 24 }, diff;
    return (diff = (compairDate - this) / o[unit]) < 0 ? Math.ceil(diff) : Math.floor(diff);
}
Date.create = function (y, M, d, H, m, s) { return new Date(y, M - 1, d, H || 0, m || 0, s || 0) }

function URI(url)
{
    var match = /(\w+):\/\/([^:\/]+)(?::(\d+))?([^:?#]*)(?:\?([^#]*))?(?:#(.*))?/.exec(url);
    this.yes = match && match[0] == url;
    if (!this.yes) return;
    this.href = match[0];
    this.protocol = match[1];
    this.host = match[2];
    this.port = match[3];
    this.pathname = match[4];
    this.search = match[5];
    this.hash = match[6];
};

function Dictionary(data, repeat)
{
    this.items = data || {};
    this.count = 0;
    this.keys = new Array;
    this.add = function (key, value)
    {
        if (this.contains(key))
        {
            if (repeat) this.items[key] += ', ' + value;
            else this.items[key] = value;
        }
        else
        {
            this.items[key] = Is.UNDEFINED(value) ? null : value;
            this.count++;
            this.keys.push(key);
        }
    };
    this.remove = function (key)
    {
        if (!this.contains(key)) return;
        delete this.items[key];
        this.keys = this.keys.without(key);
        this.count--;
    };
    this.contains = function (key) { return this.items[key] !== undefined; };
    this.forEach = function (callback) { for (key in this.items) callback(key, this.items[key], this.items) };
    this.toString = function ()
    {
        var strings = new Array;
        this.forEach(function (key, value)
        {
            strings.push([key, value.toString()].join('='));
        });
        return strings.join('&');
    };

    if (Is.STRING(this.items))
        this.items = this.items.hash();

    for (key in this.items)
    {
        this.count++;
        this.keys.push(key);
    }
};

$ = function (element)
{
    if (arguments.length > 1 && arguments[1] != false)
    {
        for (var i = 0, arg, arr = []; arg = arguments[i++]; ) arr.push($(arg));
        return arr;
    }
    else
    {
        if (typeof element === 'string') element = document.getElementById(element);
        if (element == null) return null;
        if (element['__extended__'] == 'extended' || arguments[1] === false) return element;
        return $T(element, $T(DOMExtendProperties, { __extended__: 'extended' }));
    }
}
$T = function (object, properties)
{
    if (!window.debug)
        for (prop in properties) object[prop] = properties[prop];
    else
        for (prop in properties) try { object[prop] = properties[prop]; } catch (ex) { alert(prop, properties[prop]); };
    return object;
}
$A = function (collection)
{
    try { return collection.toArray ? collection.toArray() : Array.prototype.slice.call(collection, 0) }
    catch (ex) { for (var i = 0, l = collection.length, array = []; i < l; i++) array.push(collection[i]); return array }
}
$C = function (tag, styles, props)
{
    var element = $(document.createElement(tag));
    if (styles) $T(element.style, styles);
    if (props) $T(element, props);
    return element;
}
$G = function (element)
{
    for (var arr = [], i = 1, arg; arg = arguments[i++]; )
        arr.push(element[arg]);
    return arr;
}
if (!Browser.msie && !Browser.opera)
{
    HTMLElement.prototype.__defineGetter__("innerText", function () { return this.textContent });
    HTMLElement.prototype.__defineSetter__("innerText", function (text) { this.textContent = text });
    HTMLElement.prototype.__defineGetter__("currentStyle", function () { return document.defaultView.getComputedStyle(this, null) });
    HTMLElement.prototype.fireEvent = function (eventType)
    {
        this.dispatchEvent(function () { this.initEvent(eventType.substr(2), true, true); return this } .call(document.createEvent("HTMLEvents")));
    };

    HTMLTableElement.prototype.insertRow =
	HTMLTableSectionElement.prototype.insertRow = function () { return this.appendChild(document.createElement('TR')) };
    HTMLTableRowElement.prototype.insertCell = function () { return this.appendChild(document.createElement('TD')) };

    Event.prototype.__defineGetter__("keyCode", function (value) { return this.which });
    Event.prototype.__defineSetter__("returnValue", function (value) { if (!value) this.preventDefault() });
    Event.prototype.__defineSetter__("cancelBubble", function (value) { if (value) this.stopPropagation() });
    Event.prototype.__defineGetter__("srcElement", function () { var node = this.target; while (node && node.nodeType != 1) node = node.parentNode; return $(node) });
    Event.prototype.__defineGetter__("offsetX", function () { return this.layerX });
    Event.prototype.__defineGetter__("offsetY", function () { return this.layerY });
    Event.prototype.__defineGetter__("x", function () { return this.pageX });
    Event.prototype.__defineGetter__("y", function () { return this.pageY });

    HTMLElement.prototype.setCapture = function () { window.captureEvents(Event.MOUSEMOVE) }
    HTMLElement.prototype.releaseCapture = function () { window.releaseEvents(Event.MOUSEMOVE) }

    HTMLElement.prototype.contains = function (ancestor)
    {

        var a = this.compareDocumentPosition(ancestor)
        return (a & 8) === 8
    }

};
if (!window.detachEvent)
{
    HTMLDocument.prototype.attachEvent = window.attachEvent = HTMLElement.prototype.attachEvent = function (eventName, listener)
    {
        this.addEventListener(eventName.substr(2), listener, false)
    }
    HTMLDocument.prototype.detachEvent = window.detachEvent = HTMLElement.prototype.detachEvent = function (eventName, listener)
    {
        this.removeEventListener(eventName.substr(2), listener, false)
    }
}
function $E(element, eventType, listener, isAttach)
{
    var el = $(element, false);
    if (!el) throw new Error('element "' + element + '" is null');
    var fn = function (e) { listener.call(el, e) };
    isAttach === false ? el.detachEvent(eventType, fn) : el.attachEvent(eventType, fn);
}
DEP = DOMExtendProperties = {
    moveTo: function (x, y) { this.style.left = x + 'px'; this.style.top = y + 'px'; return this },
    resize: function (width, height) { if (!isNaN(width)) this.style.width = width + 'px'; if (!isNaN(height)) this.style.height = height + 'px'; return this },
    html: function (sHtml) { if (sHtml === undefined) return this.innerHTML; this.innerHTML = sHtml; return this },
    attr: function (name, value) { this[name] = value; return this },
    visible: function () { return this.style.display != 'none' },
    hide: function () { this.style.display = 'none'; if (this.onHide) this.onHide(); return this },
    show: function (odis) { if (odis === false) return this.hide(); this.style.display = odis === true || odis === undefined ? '' : odis; if (this.onShow) this.onShow(); return this; },
    toggle: function (odis) { return this.realStyle('display') == 'none' ? this.show(odis) : this.hide() },
    realStyle: function (prop) { return prop ? this.currentStyle[prop] : this.currentStyle },
    prev: function () { var node = this.previousSibling; while (node.nodeType != 1) node = node.previousSibling; return $(node) },
    next: function () { var node = this.nextSibling; while (node.nodeType != 1) node = node.nextSibling; return $(node) },
    father: function (tag) { if (tag === undefined) return $(this.parentNode); var node = this; while (node.tagName != tag.toUpperCase()) node = node.parentNode; return $(node) },
    childs: function (tag, value)
    {
        var all = $A(this.childNodes).filter(function (node) { return node.nodeType == 1 });
        if (!isNaN(tag)) return $(all[tag]);
        return tag ? all.filter(value ? function (node) { return node[tag] == value } : function (node) { return node.tagName == tag.toUpperCase() }) : all;
    },
    child: function (tag) { return $A(this.getElementsByTagName(tag)).map(function (node) { return $(node) }) },

    remove: function () { var el = this; this.parentNode.removeChild(this); return $(el); },
    pos: function ()
    {
        var el = this, _x = el.offsetLeft, _y = el.offsetTop, _h = el.offsetHeight, _w = el.offsetWidth;
        while (el = el.offsetParent) { _x += el.offsetLeft; _y += el.offsetTop; }
        return { left: _x, top: _y, bottom: _h + _y, right: _w + _x, width: _w, height: _h };
    },
    realStyle: function (prop) { return this.currentStyle[prop] },
    opacity: function (alpha) { return Browser.msie ? this.css('filter', 'alpha(opacity=' + alpha + ')') : this.css('opacity', alpha / 100) },

    on: function (eventName, listener, force)
    {
        if (force) $E(this, "on" + eventName, listener);
        else this.attachEvent ? this.attachEvent("on" + eventName, listener) : this.addEventListener(eventName, listener, false)
        return this;
    },
    un: function (eventName, listener)
    {
        this.detachEvent ? this.detachEvent("on" + eventName, listener) : this.removeEventListener(eventName, listener, false)
        return this;
    },
    css: function (prop, value) { this.style[prop] = value; return this; },
    insert: function (tag, props, styles, position)
    {
        var elem = $C(tag, styles, props);
        ({
            beforeBegin: function (node) { this.parentNode.insertBefore(node, this) },
            afterBegin: function (node) { this.insertBefore(elem, this.firstChild) },
            beforeEnd: function (node) { this.appendChild(elem) },
            afterEnd: function (node) { if (this.nextSibling) this.parentNode.insertBefore(node, this.nextSibling); else this.parentNode.appendChild(node) }
        })[position || 'beforeEnd'].call(this, elem);
        return elem;
    },
    cls: function ()
    {
        return new (function (e)
        {
            if (window.debug)
            {
                var clsn = e.className.trim().split(/\s+/);
                this.add = function (cn) { clsn.push(cn); return this }
                this.remove = function (cn) { clsn = clsn.filter(function (k) { return k != cn }); return this }
                this.replace = function (on, cn) { return this.remove(on).add(cn) }
                this.have = function (cn) { return clsn.indexOf(cn) > -1 }
                this.apply = function () { e.className = clsn.join(' ').trim(); return e }
            }
            else
            {
                this.add = function (cn) { if (!e.className) e.className = cn; else e.className += ' ' + cn; return this }
                this.remove = function (cn) { e.className = cn ? (' ' + e.className + ' ').replace(new RegExp("\s*" + cn + "\s*", 'g'), ' ').trim() : ''; return this }
                this.have = function (cn) { return (' ' + e.className + ' ').indexOf(' ' + cn + ' ') > -1; }
            }
        })(this)
    }
}

window.on = document.on = DOMExtendProperties.on;
window.un = document.un = DOMExtendProperties.un;
window.ready = function (func)
{
    if (Is.STRING(func)) func = new Function(func);
    window.on('load', func);
};
document.onmousewheel = function (evt)
{
    var e = evt || window.event;
    if (e.preventDefault && e.ctrlKey) e.preventDefault();
    if (e.ctrlKey) e.returnValue = false;
};
if (window.addEventListener)
    window.addEventListener('DOMMouseScroll', document.onmousewheel, false);
function disableTabKey(e)
{
    var event = window.event || e;
    if (event.keyCode == 9) event.returnValue = false
}

function resize(img, size, callback)
{
    var n = new Image();
    n.src = img.src;

    if (Browser.msie) ok();
    else n.onload = function ()
    {
        if (n.complete == true) ok();
    }

    function ok()
    {
        var w = n.width, h = n.height;
        if (w >= size) { h = size * h / w; w = size; }
        if (h >= size) { w = size * w / h; h = size; }
        img.width = w; img.height = h;
        if (callback) callback.call(img, size, [n.width, n.height]);
        n = null;
    }
};

document.cookies = cookies = {
    set: function (name, value, days, path)
    {
        var string = name + '=' + escape(value);
        if (!isNaN(days))
        {
            var date = new Date();
            date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
            string += ';expires=' + date.toGMTString();
        }
        if (path) string += ';path=' + path
        document.cookie = string;
    },
    get: function (name)
    {
        var array = document.cookie.match(new RegExp('(^| )' + name + '=([^;]*)(;|$)'));
        return array == null ? '' : unescape(array[2]);
    },
    clear: function (name)
    {
        document.cookie = name + "=; expires=" + new Date('1950-1-1').toGMTString();
    }
};

function TAB_SET(tabs, panels, options)
{
    var method = (options = options || {}).method || 'onclick', me = this;
    if (options.init) options.init(tabs, panels);
    else if (panels) panels.forEach(function (panel) { panel.style.display = 'none' });

    var current = { tab: null, panel: null }
    var transfer = options.transfer || function (current, last)
    {
        if (last.panel) last.panel.hide();
        if (current.panel) current.panel.show();
    }

    tabs.forEach(function (tab, i)
    {
        tab.index = i;
        tab.cls().add('normal');
        $E(tab, method, function ()
        {
            if (options.onChange && options.onChange.call(me, this.index, tabs, panels) === false) return;

            var last = $T({}, current);

            if (current.tab) current.tab.cls().remove('current').add('normal');
            (current.tab = this).cls().remove('normal').add('current');
            if (panels) current.panel = panels[i];
            transfer(current, last);
        });
    });
    this.show = function (index) { tabs[index].fireEvent(method) }
    var dftTab = options.defaultTab || 0;
    if (dftTab > -1) this.show(dftTab);
}

document.ready = (function ()
{
    if (!!document.addEventListener)
        return function (fn) { document.addEventListener("DOMContentLoaded", fn, false) };
    else
    {
        var list = new Array();
        document.write('<script id="__onDOMContentLoaded" defer="defer" src="//:"></script>');
        $('__onDOMContentLoaded', false).onreadystatechange = function ()
        {
            if (this.readyState == 'complete') list.forEach(function (fn) { fn() });
        };
        return function (fn) { list.push(fn) }
    }
})();
(function ()
{
    document.hash = {};
    if (location.hash && location.hash.substr(1).trim()) location.hash.substr(1).split('&').forEach(function (hash)
    {
        var arr = hash.toLowerCase().split('=');
        document.hash[arr[0]] = arr[1] || arr[0];
    });
    document.query = {};
    if (location.search && location.search.substr(1).trim()) location.search.substr(1).split('&').forEach(function (sear)
    {
        var arr = sear.toLowerCase().split('=');
        document.query[arr[0]] = arr[1] || arr[0];
    });
})();
document.ready(function ()
{
    document.head = document.getElementsByTagName('HEAD').item(0);
    if (Browser.msie) document.execCommand("BackgroundImageCache", false, true);
});
window.drag = function (e, module, handle, options)
{
    options = options || {};
    if (options.onInit && options.onInit(e, module, handle) === false) return false;
    $(handle.ownerDocument).on('mousemove', start).on('mouseup', stop);
    function start(e)
    {
        e = e || window.event;
        module.style.left = module.subX + e.clientX + 'px';
        module.style.top = module.subY + e.clientY + 'px';
        if (options.onDrag) options.onDrag.call(null, e, module, handle);
    }
    function stop()
    {
        $(handle.ownerDocument).un('mousemove', start).un('mouseup', stop);
        if (!Browser.msie) module.opacity(100);
        if (options.onStop) options.onStop.call(null, e, module, handle);
        handle.releaseCapture();
    }
    e = e || window.event;
    module.subX = module.offsetLeft - e.clientX;
    module.subY = module.offsetTop - e.clientY;
    if (options.onStart) options.onStart(e, module, handle);
    handle.setCapture();
    if (!Browser.msie) module.opacity(50);
}
window.pupop = function (title, url, width, height, options)
{
    options = options || {};
    var win = options.target || window;
    if (win.pupopInstance) return;

    win.zIndex = top.zIndex || 10000;

    var bsize = $G(win.document.documentElement, 'clientWidth', 'clientHeight', 'scrollLeft', 'scrollTop');
    win.onscroll = function () { win.scrollTo(bsize[2], bsize[3]) }

    var mask = $C('div', { cssText: 'top:{3}px;left:0;position:fixed;_position:absolute;width:{2}px;height:{1}px;background:silver;filter:alpha(opacity=0);opacity:0;z-index:{0};display:none'.format(top.zIndex++, bsize[1] + (Browser.ie6 ? bsize[2] : 0), bsize[0], bsize[3]) });
    if (Browser.ie6) mask.html('<iframe style="z-index:-1;position:absolute;top:0;left:0;filter:alpha(opacity=0);opacity:0;width:100%;height:100%"></iframe>'.format(bsize[0], bsize[1]));
    var box = $C('div', { cssText: '-moz-border-radius:5px;position:fixed;_position:absolute;width:{0}px;height:{1}px;z-index:{2};top:{4}px;left:{3}px;border:1px solid silver;filter:alpha(opacity=0);opacity:0;display:none">'.format(width, height, top.zIndex++, (bsize[0] - width) * .5, (bsize[1] - height) * .5 + (Browser.ie6 ? bsize[3] : 0)) });
    box.html(''
		 + '<div class="pupop_title" id="pupop_title" style="background-color:#e9f2fb;height:{0}px;" onmousedown="drag(event,this.parentNode,this,{onInit:function(e){return !/IMG|BUTTON/.test(e.srcElement.tagName)}})">'.format(options.tHeight || 24)
		 + '  <label style="float:left;_padding-top:3px">{0}{1}</label>'.format(options.icon ? '<img src="{0}" style="margin:0 3px -3px 0;width:16px;height:16px" ondblclick="closePupop()"/>'.format(options.icon) : "", title)
		 + '  <span style="float:right"><button type="button" style="border-width:0" title="close" onmousedown="return false" onclick="closePupop()">&nbsp;</button></span>'
		 + '</div>'
		 + '<div class="pupop_body" id="pupop_body" style="height:' + (height - (options.tHeight || 24)) + 'px;background-color:white;' + (options.htmlStyle || '') + '">' + (options.isHtml ? url : '<iframe src="" frameborder="0" width="100%" height="100%"></iframe>') + '</div>');

    with (Browser.msie ? win.document.body : win.document.documentElement)
    {
        appendChild(mask).show()[Browser.msie ? 'opacity' : 'fadeIn'](60);
        appendChild(box).show()[Browser.msie ? 'opacity' : 'fadeIn'](100);
    }
    win.pupopInstance = { mask: mask, win: box, command: function () { if (options.command) options.command.apply(null, arguments) } }
    box.focus();

    win.closePupop = function ()
    {
        if (Browser.msie) { mask.remove(); box.remove() }
        else { mask.fadeOut({ after: function () { mask.remove() } }); box.fadeOut({ after: function () { box.remove() } }) }
        win.pupopInstance = null;
        win.onscroll = null;
        if (options.rel) options.rel.focus();
    }
    if (this != window)
    {
        this.close = win.closePupop;
        this.clear = function () { win.document.getElementById('pupop_body').innerHTML = '' };
        this.setTitle = function (title) { win.document.getElementById('pupop_title').innerHTML = title }
        this.write = function (html) { win.document.getElementById('pupop_body').innerHTML += String.format.apply(null, arguments) }
    }
    if (!options.isHtml) setTimeout(function () { win.document.getElementById('pupop_body').childNodes[0].src = url }, 1);
}

DOMExtendProperties.fadeIn = function (endAlpha, options)
{
    if (options && options.before) if (options.before.call(this) === false) return;
    endAlpha = endAlpha || 100;
    this.opacity(this._alpha = 0);
    var me = this, t = setInterval(function ()
    {
        me.opacity(me._alpha += 10);
        if (me._alpha == endAlpha) { clearInterval(t); if (options && options.after) options.after.call(me) }
    }, 25);
    return this;
}

DOMExtendProperties.fadeOut = function (options)
{
    if (options && options.before) if (options.before.call(this) === false) return;
    var me = this, t = setInterval(function ()
    {
        me.opacity(me._alpha -= 10);
        if (me._alpha == 0) { clearInterval(t); if (options && options.after) options.after.call(me) }
    }, 25);
    return this;
}
